﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MINERP.DAL;
using MINERP.MODEL.FoundationModel;
using MINERP.COM;

namespace MINERP.BLL.InnerFactory
{
    public class ProduceView
    {
        /// <summary>
        /// 定单信息
        /// </summary>
        public Tb_OrderBag_Info Order { get; set; }

        /// <summary>
        /// 产品信息
        /// </summary>
        public OrderInfo_Info Product { get; set; }
        /// <summary>
        /// 工厂信息
        /// </summary>
        public OutProcessShop_Info Factory { get; set; }
        /// <summary>
        /// 工厂加工信息
        /// </summary>
        public OutProcessRecord_Info ProduceInfo { set; get; }
        /// <summary>
        /// 产品类型的基本信息
        /// </summary>
        public Tb_Product_Info ProductType { get; set; }

        public Tb_OutShop_ProductCategory_Info OutShop_ProductCategory { get; set; }

        public string OrderPath { get { return Product.OrderPath; } }


        public int OrderId
        {
            get
            {
                return Order.OrderBagId;

            }
        }
        public string OrderName
        {
            get
            {
                return Order.BagName;
            }
        }
        public string OrderBarcode
        {
            get
            {
                return Order.BagCode;
            }
        }
        public string ShopName
        {
            get
            {
                return Order.ShopName;
            }
        }
        public int ShopId
        {
            get { return Order.ShopID; }
        }

        public int ProductId
        {
            get { return Product.OrderProductId; }
        }


        public string tb_ProductName
        {
            get
            {
                return ProductType.ProductName;
            }
        }


        public string ProductName
        {
            get { return Product.OrderProductName; }
        }
        public string ProductCode
        {
            get { return Product.OrderProductCode; }
        }
        public string CtmName
        {
            get { return Product.CtmName; }
        }
        //public double Width
        //{
        //    get { return Product.Width; }
        //}

        //public double Height
        //{
        //    get { return Product.Height; }
        //}
        public string Size
        {
            get
            {
                return Product.Width + "×" + Product.Height;
            }
        }
        public int ProductNum
        {
            get { return Product.PageNum; }
        }

        public string Remark
        {
            get { return Product.Remark + ProduceInfo.OutRemark; }
        }
        public int FactoryId
        {
            get { return Factory.OutShopId; }
        }

        public string FactoryName
        {
            get { return Factory.OutShopName; }
        }
        public int OutProcessRecordId
        {
            get { return ProduceInfo.OutProcessRecordId; }
        }
        public DateTime CreateTime
        {
            get { return ProduceInfo.CreateTime; }
        }
        //public string OutRemark
        //{
        //    get { return ProduceInfo.OutRemark; }
        //}
        public DateTime StartProductTime
        {
            get { return ProduceInfo.StartProductTime; }
        }
        public DateTime EndProductTime
        {
            get { return ProduceInfo.EndProductTime; }
        }
        public string ProduceRemark
        {
            get { return ProduceInfo.Remark; }
        }
        public int IntStatus
        {
            get { return ProduceInfo.Status; }
        }
        public int IntStutas2
        {
            get { return ProduceInfo.Status2; }
        }
        public string Status
        {
            get
            {
                string strStr = "";
                switch (this.ProduceInfo.Status)
                {
                    case (int)OutProcessRecordStatus.Outing:
                        {
                            switch (this.ProduceInfo.Status2)
                            {
                                case (int)OutProcessRecordStatus2.Doing:
                                    strStr = "正在生产";
                                    break;
                                case (int)OutProcessRecordStatus2.Error:
                                    strStr = "暂停生产";
                                    break;
                                case (int)OutProcessRecordStatus2.Complete:
                                    strStr = "生产完成";
                                    break;
                                default:
                                    strStr = "等待接收";
                                    break;
                            }
                        }
                        break;
                    case (int)OutProcessRecordStatus.InGrid:
                        {
                            strStr = "未打印(在格子中)";
                        }
                        break;
                    case (int)OutProcessRecordStatus.OutWaitFenDui:
                        {
                            strStr = "未打印(等待分堆)";
                        }

                        break;
                }
                return strStr;
            }
        }

        public int TimeSpan
        {
            get;
            set;
        }
        public int PageNum
        {
            get
            {
                return Product.PageNum;
            }
        }

        public DateTime PreCompleteDateTime
        {
            get
            {
                return StartProductTime.AddHours(TimeSpan);
            }
        }
        public DateTime FacthTime
        {
            get
            {
                return Order.FetchTime;
            }
        }

    }
}
